﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Slick.MapEditor;
using Slick.MapEditor.Tools;

namespace Slick
{
    public partial class MapSidePanel : UserControl
    {
        public Map Map;

        public MapSidePanel()
        {
            InitializeComponent();
        }

        public void Initialise(Map map)
        {
            this.Map = map;
            this.tilesControl.Initialise(map);
            this.entityPaletteControl.Initialise(map);
            this.entityPropertiesControl.Initialise(map);
            this.layersControl.Initialise(map);
        }

        private void Tabs_Selected(object sender, TabControlEventArgs e)
        {
            // Switch tool based on tab selected!
            Mode toolMode;
            if (e.TabPage == tabTiles)
                    toolMode = Mode.PaintTiles;
            else if (e.TabPage == tabEntityPalette)
                    toolMode = Mode.AddEntity;
            else if (e.TabPage == tabEntityProperties)
                    toolMode = Mode.SelectEntity;
            else
                    throw new NotImplementedException();

            // Set mode
            ((MapMode)Editor.CurrentMode).ToolController.SetMode(toolMode);
        }

        private void entitiesControl_Load(object sender, EventArgs e)
        {

        }

        private void Tabs_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
